<script setup lang="ts">
// 使用counterStore
// 1. 导入store
import { useCounterStore} from './store/counterStore'
import { useChannelStore} from './store/channelStore'
import { onMounted } from 'vue';
import {storeToRefs} from 'pinia'
// 2. 执行方法得到store实例对象
const counterStore = useCounterStore()
const channelStore = useChannelStore()
console.log(counterStore);
const {count, doubleCount} = storeToRefs(counterStore) 

onMounted(() => {
  channelStore.getList()
})

</script>

<template>
  <div class="app-page">
    {{ count }}---
    {{ doubleCount }}
    <button @click="counterStore.increment">+1</button>
    <ul>
      <li v-for="item in channelStore.list" :key="item.id">{{ item.name }}</li>
    </ul>
  </div>
</template>

<style scoped></style>
